Data processing is a fundamental part of computer programming. One can choose from amongst a variety of programming languages with which to author programs. The selected language for a particular application may depend on the application context, a developer's preference, or a company policy, among other factors. Regardless of the selected language, a developer will ultimately have to deal with data, namely querying and updating data.
A technology called language-integrated queries (LINQ) was developed to facilitate data interaction from within programming languages. LINQ provides a convenient and declarative shorthand query syntax to enable specification of queries within a programming language (e.g., C#®, Visual Basic® . . . ). More specifically, query operators are provided that map to lower-level language constructs or primitives such as methods and lambda expressions. Query operators are provided for various families of operations (e.g., filtering, projection, joining, grouping, ordering . . . ), and can include but are not limited to “where” and “select” operators that map to methods that implement the operators that these names represent. By way of example, a user can specify a query in a form such as “from n in numbers where n<10 select n,” wherein “numbers” is a data source and the query returns integers from the data source that are less than ten. Further, query operators can be combined in various ways to generate queries of arbitrary complexity.
While queries can be executed locally over in-memory data, the queries can also be remoted, for example, to another computer for execution. In this scenario, a query is represented as data rather than code. This data representation of a query (e.g., expression tree) can subsequently be translated to target any data source. For example, a language-integrated query can be translated into SQL (Structured Query Language) for execution by a relational database system. As another example, a data representation of a language integrated query can translated into XQuery to enable execution with respect to XML (eXtensible Markup Language) data.